%div

  - if User.current.git_allowed_to?(:create_repository_mirrors, @repository)
    .contextual= link_to l(:label_mirror_add), new_repository_mirror_path(@repository), class: 'icon icon-add modal-box'

  %h3= l(:label_repository_mirrors)

  - if @repository_mirrors.any?

    %table{ class: 'table table-hover' }
      %thead
        %tr
          %th= l(:label_url)
          %th= l(:label_mirror_refspec)
          %th= l(:label_mode)
          %th= l(:label_enabled)
          %th

      %tbody
        - @repository_mirrors.each do |mirror|
          %tr
            %td= mirror.url
            %td= refspec(mirror, 64).html_safe
            %td= mirror_mode(mirror).html_safe
            %td= checked_image2 mirror.active?

            %td{ class: 'buttons' }
              - if User.current.git_allowed_to?(:push_repository_mirrors, @repository)
                = link_to label_with_icon(l(:label_mirror_push), 'fa-rocket', class: 'fa-align'), push_repository_mirror_path(@repository, mirror), class: 'modal-box-close-only'

              - if User.current.git_allowed_to?(:edit_repository_mirrors, @repository)
                = link_to l(:button_edit), edit_repository_mirror_path(@repository, mirror), class: 'icon icon-edit modal-box'
                = link_to l(:button_delete), repository_mirror_path(@repository, mirror), remote: true, method: :delete, confirm: l(:text_are_you_sure), class: 'icon icon-del'

  - else
    %p{ class: 'nodata' }= l(:label_no_data)

  .git_hosting_spacer

  %div{ style: 'margin: 2px 3px; width: 99%;' }
    %div
      = zero_clipboard_button_for('mirror_pubkey')
      %span{ style: 'margin-left: 10px;' }= l(:label_mirror_help) + ' :'

    .git_hosting_spacer

    %textarea{ id: 'mirror_pubkey', readonly: 'readonly', style: 'height: 100px; width: 99%; font-family: sans-serif;' }= RedmineGitHosting::Config.mirroring_public_key

  .git_hosting_spacer
